<template>
    <div class="nav">
        <div class="left-items">
            <a class="item-a" @click="openLeftSide">
                <img class="menu-img" src="../assets/burger.png" alt="">
            </a>
        </div>
        <p>存在</p>
        <div class="right-items">
            <a class="item-a" href="#/srarch">
                <img class="menu-img" src="../assets/search.png" alt="">
            </a>
            <a class="item-a" @click="onSortView($event)">
                <img class="menu-img-last" src="../assets/settings.png" alt="">
            </a>
        </div>
    </div>
</template>

<script>
export default {
  name: 'navBar',
  data () {
    return {
    }
  },
  methods: {
    openLeftSide () {
      this.$emit('on-left-side', {})
    },
    onSortView (event) {
      let pointer = {
        x: event.target.offsetLeft,
        y: event.target.offsetTop,
        height: event.target.height,
        width: event.target.width
      }
      this.$emit('on-sort-view', pointer)
    }
  }
}
</script>

<style scoped>
.menu-img,
.menu-img-last{
    width: 30px;
    height: 30px;
}
.menu-img{
 margin-right: 15px;
}
.item-a{
    display: flex;
    align-items: center;
}
.left-items,
.right-items{
    width: 30%;
    display: flex;
    justify-content: flex-start;
    pointer-events: initial;
    align-items: center;
}
.right-items{
    justify-content: flex-end;
}
  a{
      text-decoration: none;
      color: white;
  }
  .nav{
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: transparent;
    z-index: 10000;
    color: white;
    font-size: 26px;
    /*padding-left: 10px;
    padding-right: 10px;*/
    width: 90%;
    box-sizing: border-box;
  }
</style>
